﻿using Business.BookManagement;
using Business.BookManagement.Dto;
using Business.BorrowManagement;
using Business.BorrowManagement.Dto;
using Business.RGoodManagement.Dto;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Domain.Repositories;

namespace Business.Controllers
{
    [RemoteService]
    [Area("Business")]
    [Route("api/business/borrow")]
    public class BorrowController : AbpController
    {
        private readonly IBorrowAppService _BorrowAppService;

        public BorrowController(IBorrowAppService BorrowAppService)
        {
            _BorrowAppService = BorrowAppService;
        }
        /// <summary>
        /// 添加或修改借阅信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>

        [HttpPost]
        [Route("data-post")]
        public Task<BorrowDto> CreateOrUpdate(BorrowDto input)
        {
            return _BorrowAppService.CreateOrUpdate(input);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("delete")]
        public Task Delete(List<Guid> ids)
        {
            return _BorrowAppService.Delete(ids);
        }
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        [HttpGet]
        [Route("{id}")]
        public Task<BorrowDto> Get(Guid id)
        {
            return _BorrowAppService.Get(id);
        }
        /// <summary>
        /// 获得全部
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<PagedResultDto<BorrowDto>> GetAll(GetBorrowInputDto input)
        {
            return _BorrowAppService.GetAll(input);
        }
        /// <summary>
        /// 明细  
        /// </summary>  
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("detail")]
        public  Task<PagedResultDto<RGoodDto>> GetAllDetail(GetBorrowInputDto input)
        {
            return _BorrowAppService.GetAllDetail(input);
        }

    }
}
